<#include "../common/layout.ftl"/>
<@layout>
<div class="well">
	<span class="label label-success">添加用户</span>
	<form id="form1" class="well form-horizontal" action="save"  method="post">
      <div class="control-group">
        <label class="control-label" for="focusedInput">用户名：</label>
        <div class="controls" >
          <input class="input-xlarge focused" name="user_name" id="username" type="text" style="height: 26"  >
        </div>
      </div>
       <div class="control-group">
        <label class="control-label" for="focusedInput">密码：</label>
        <div class="controls" >
          <input class="input-xlarge focused" name="password" id="password" type="password"  style="height: 26" >
        </div>
      </div>
       <div class="control-group">
        <label class="control-label" for="focusedInput">真实姓名：</label>
        <div class="controls" >
          <input class="input-xlarge focused" name="real_name" id="realname" type="text"  style="height: 26">
        </div>
      </div>
       <div class="control-group">
        <label class="control-label" for="focusedInput">手机号码：</label>
        <div class="controls" >
          <input class="input-xlarge focused" name="cell_phone" id="cellphone" type="text"  style="height: 26"  >
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="focusedInput">角色：</label>
        <div class="controls" >
          <select name="role" id="role" onchange="roleChanged()">
          	<option value="admin">admin</option>
          	<option value="seniorManager">高级管理员</option>
          	<option value="brandManager">品牌管理员</option>
          	<option value="middleManager">分公司客服</option>
          	<option value="customerCenter">集团客服</option>
          	<option value="entManager">企业管理员</option>
          </select>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="focusedInput">公司代码：</label>
        <div class="controls" >
          <input class="input-xlarge focused" name="company" id="company" type="text" style="height:26" readonly="true"/>
        </div>
      </div>
      <div class="form-actions">
        <button type="submit" class="btn btn-primary" onsubmit="save()">确 定</button>
        <button type="reset" class="btn">重 置</button>
        <button type="button" class="btn btn-info" onclick="javascript:history.back();">返回</button>
      </div>
  </form>
  </div>

<script>
	$(function() { 
     $("#form1").validity(function() {
         $("#username").require();
         $("#password").require();
         $("#realname").require();
         $("#cellphone").require().match("number");
     });
 }); 
	 function roleChanged(){
	 	var roleValue=$("#role").val();
	 	if(roleValue=="brandManager" || roleValue=="middleManager" || roleValue=="customerCenter"){
	 		$("#company").removeAttr("readonly");
	 	}else{
	 		$("#company").attr("readonly","true");
	 	}
	 }
</script>
</@layout>